#include <iostream>
#include <string>
#include <iomanip>
#include <stdexcept>
#include <algorithm>
#include <list>
#include "grade.h"
#include "Student_info.h"
using namespace std;

list<Student_info> extract_fails(list<Student_info> & students)
{
	//TODO
    list<Student_info> fail;
    for (auto it = students.begin();it != students.end();) {
        if(fgrade(*it)) {
            fail.push_back(*it);
            it = students.erase(it);
        } else {
            it++;
        }
    }
    return fail;
}


int main() 
{
    list<Student_info> students;
    Student_info record;
    
    // 读取学生数据
    while(read(cin, record)) {
        students.push_back(record);

    }
    
    students.sort(compare);

    auto fails = extract_fails(students);
    cout.setf(ios::fixed);
	cout<<setprecision(1);
    for(auto& s : fails) {
        cout <<setw(10)<<left<<s.name<<"Your final grade is "<< grade(s)<< endl;
    }
    return 0;
}
